package com.creataion.prototype;

//表示当前对象可被克隆
public class DrRing implements Cloneable {
    private String name;
    private Float price;

    public DrRing() {
        System.out.println("本类型钻戒一生只为一人定制");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "DrRing{" +
                "name='" + name + '\'' +
                ", price=" + price +
                '}';
    }
//   创建一个购买渠道 ，购买之后告诉我所有信息
    @Override
    protected Object clone() {
        DrRing drRing = new DrRing();
        drRing.setName("小猪佩奇");
        drRing.setPrice(5000f);
        return drRing;
    }
}
